﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第九十三题
//BC95 最高分与最低分之差
//https://www.nowcoder.com/practice/e0e4f81dcd55408a8973f8033bbeb1d2?tpId=107&tqId=33376&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

#include <stdio.h>

int main() {
    int n = 0;
    int arr[10000] = { 0 };
    scanf("%d", &n);

    //输入n个整数
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
    //找最大值和最小值
    int max = arr[0];
    int min = arr[0];
    for (int i = 0; i < n; i++) {
        if (max < arr[i]) {
            max = arr[i];
        }
        if (min > arr[i]) {
            min = arr[i];
        }
    }
    printf("%d\n", max - min);
    return 0;
}